Table of Contents
Fetching ...

Can ChatGPT implement finite element models for geotechnical engineering applications?

Taegu Kim, Tae Sup Yun, Hyoung Suk Suh

TL;DR

This work investigates whether a pre-trained large language model (ChatGPT) can generate finite element codes for hydro-mechanical problems in unsaturated geotechnical soils. It uses a monolithic three-field poromechanics formulation, derives weak forms from strong forms, and tests Code generation in two environments (FEniCS and MATLAB) across three model problems: 1D pore-pressure diffusion, saturated footing settlement, and gravity-driven seepage with unsaturated flow. Prompt augmentation—guided by error messages—and minimal human intervention are used to achieve verification/validation against analytical or benchmark results, with FEniCS generally outperforming MATLAB due to higher-level abstractions. The findings suggest LLMs can substantially aid FE code development as collaborative tools, though expert oversight remains essential for reliability and complex formulations.

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.

Can ChatGPT implement finite element models for geotechnical engineering applications?

TL;DR

This work investigates whether a pre-trained large language model (ChatGPT) can generate finite element codes for hydro-mechanical problems in unsaturated geotechnical soils. It uses a monolithic three-field poromechanics formulation, derives weak forms from strong forms, and tests Code generation in two environments (FEniCS and MATLAB) across three model problems: 1D pore-pressure diffusion, saturated footing settlement, and gravity-driven seepage with unsaturated flow. Prompt augmentation—guided by error messages—and minimal human intervention are used to achieve verification/validation against analytical or benchmark results, with FEniCS generally outperforming MATLAB due to higher-level abstractions. The findings suggest LLMs can substantially aid FE code development as collaborative tools, though expert oversight remains essential for reliability and complex formulations.

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.
Paper Structure (17 sections, 37 equations, 14 figures, 1 table)

This paper contains 17 sections, 37 equations, 14 figures, 1 table.

Figures (14)

  • Figure 1: Schematic of geometry and boundary conditions for the numerical examples considered in this work: (a) dissipation of excess pore water pressure via fluid mass diffusion; (b) time-dependent differential settlement of a strip footing; and (c) gravity-driven seepage.
  • Figure 2: Schematic representation of the workflow for GPT-based finite element implementation.
  • Figure 3: GPT-based finite element code generation for Model Problem (1). (a) The initial prompts given to GPT; (b) an exemplary GPT-generated MATLAB script (GPT-MATLAB); and (c) the generated Python script using FEniCS (GPT-FEniCS).
  • Figure 4: Exemplary prompt augmentation process for GPT-MATLAB for Model Problem (1).
  • Figure 5: Comparison of the final numerical results from GPT-MALAB and GPT-FEniCS against the analytical solution.
  • ...and 9 more figures