firedrakeproject / firedrake

Firedrake is an automated system for the portable solution of partial differential equations using the finite element method (FEM)
https://firedrakeproject.org
Other
520 stars 160 forks source link

Adjoint variational solver #3723

Closed Ig-dolci closed 3 weeks ago

Ig-dolci commented 3 months ago

Description

This PR updates the adjoint solver by introducing a Linear Variational Solver to handle adjoint equations. It also addresses an issue arising when the Jacobian is constant and the tape recomputation is required after updating an equation parameter (a common scenario in optimisation solvers).

I have executed tests to compare computation time and memory usage between the master branch and this current branch. The tests consider three time-dependent cases:

  1. Nonlinear: Navier-Stokes and Burger's equations (5 subsequent functional recomputation and gradient calculation)

  2. Linear: FWI optimisation (5 iteration) and Heat equation (5 subsequent functional recomputation and gradient calculation)

The test scripts are available here, and the plots comparing this branch with the master branch are shown below.

Feel free to add your review to anyone interested in this PR.

burger ns fwi heat_eq

github-actions[bot] commented 2 months ago
TestsPassed ✅Skipped ⏭️Failed ❌
Firedrake complex8089 ran6506 passed1583 skipped0 failed
github-actions[bot] commented 2 months ago
TestsPassed ✅Skipped ⏭️Failed ❌
Firedrake real8095 ran7309 passed786 skipped0 failed
Ig-dolci commented 1 month ago

This PR is linked with pyadjoint PR #172.