DOLFINx-GraphAD
Automatic differentiation for DOLFINx using the adjoint method. Compute sensitivities and optimize finite element simulations with an explicit computational graph that you own.
Key Features
Computational graph construction that automatically tracks operations and dependencies.
Efficient gradient computation through backpropagation on the computational graph.
Seamless integration into existing DOLFINx workflows with minimal code changes.
Support for nonlinear problems and coupled multi-physics simulations.
Built-in tools for visualizing and debugging the computational graph.
Drop-in replacements for DOLFINx objects – just add a graph argument.
Start with Getting started or explore a complete notebook in Demos.
Featured demos
Stationary Poisson equation on a unit square. Computes gradients of a tracking-type objective w.r.t. the source term f, the diffusion coefficient \(\nu\), and the Dirichlet boundary values.
Time-dependent heat equation solved with backward Euler. Demonstrates adjoint backpropagation through multiple time steps to compute sensitivities w.r.t. the initial condition.
See all demos for linear elasticity and Stokes flow, alongside these examples.
Acknowledgments
This library builds upon the FEniCS Project and uses DOLFINx as its foundation.