MOX Report on Assessing ChatGPT for coding finite element methods

A new MOX report entitled “Assessing ChatGPT for coding finite element methods” by Orlando, G. has appeared in the MOX Report Collection.

The report can be donwloaded at the following link:

https://www.mate.polimi.it/biblioteca/add/qmox/31/2023.pdf

Abstract: ChatGPT is a language model trained by OpenAI to follow an instruction in a prompt and to provide a detailed response. We investigate the capabilities of ChatGPT to generate codes which implement the finite element method. The Finite element method (FEM) is a popular technique for the numerical solution of partial differential equations (PDEs). More specifically, we analyze the codes generated for two open source platforms: deal.II, a C++ software library, and FEniCS, for which we focus on its Python interface. We consider as benchmark problems the Poisson equation and a linear advection problem. The outcomes suggest that ChatGPT can be employed as initial building block to write finite element codes, but certain limitations and failures, which require further improvement of the machine learning model and a human supervision, are still present.