Fully and semi-automated shape differentiation in NGSolve

Peter Gangl*, Kevin Sturm, Michael Neunteufel, Joachim Schöberl

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review


In this paper, we present a framework for automated shape differentiation in the finite element software NGSolve. Our approach combines the mathematical Lagrangian approach for differentiating PDE-constrained shape functions with the automated differentiation capabilities of NGSolve. The user can decide which degree of automatisation is required, thus allowing for either a more custom-like or black-box–like behaviour of the software. We discuss the automatic generation of first- and second-order shape derivatives for unconstrained model problems as well as for more realistic problems that are constrained by different types of partial differential equations. We consider linear as well as nonlinear problems and also problems which are posed on surfaces. In numerical experiments, we verify the accuracy of the computed derivatives via a Taylor test. Finally, we present first- and second-order shape optimisation algorithms and illustrate them for several numerical optimisation examples ranging from nonlinear elasticity to Maxwell’s equations.
Original languageEnglish
Pages (from-to)1579-1607
Number of pages29
JournalStructural and multidisciplinary optimization
Issue number3
Early online date5 Nov 2020
Publication statusPublished - Mar 2021


  • Automated differentiation
  • Shape derivative
  • Shape Newton method
  • Shape optimisation

ASJC Scopus subject areas

  • Software
  • Control and Optimization
  • Control and Systems Engineering
  • Computer Science Applications
  • Computer Graphics and Computer-Aided Design

Cite this