automatic differentiation of pde solution wrt design variables in dealii

46 views
Skip to first unread message

Simon

unread,
Aug 31, 2022, 3:31:43 PM8/31/22
to deal.II User Group
Dear all,


I want to differentiate my pde solution U with respect to some design variables E, that is, computing the Jacobian dU/dE.
I already implemented the Jacobian analytically, however, I would like to double check it using AD.

" (In theory an entire program could be made differentiable. This could be useful in, for example, the sensitivity analysis of solutions with respect to input parameters. However, to date this has not been tested.)"

I found this information in the AD module.
Also the relevant tuturials -- step33, step 70, step 71 -- do not cover the topic sensitivity analysis, but only AD at cell- and quadrature point level.

That said, is it possible (with reasonable efforts) to make the entire dealii program AD differentiable, or is it recommendable to use other open source tools for that purpose?
My biggest concern is the solution of the linear system because the solver classes require in most cases a Vector<double> and, consequently, the dependency u(E) can not be encoded.


Best
Simon

Praveen C

unread,
Sep 1, 2022, 9:36:46 AM9/1/22
to Deal. II Googlegroup
It depends on what kind of problem you have, linear or nonlinear, steady-state or transient.

For example, in case of a linear BVP you may have


A(E) U(E) = b(E)

then

A(E) U’(E) = b’(E) - A’(E) U(E)

Use AD to compute b’(E), A’(E) which involves applying AD to the assemble process, that is used in some of the tutorial examples, and solve the matrix problem using the same solver you use for the original problem. This way you dont have to differentiate the matrix iterative process itself.

Best
praveen


--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/f9f35931-c2b1-4e49-9910-e142b7684804n%40googlegroups.com.

Simon Wiesheier

unread,
Sep 1, 2022, 12:04:58 PM9/1/22
to dea...@googlegroups.com
My problem is nonlinear but steady-state and I formulated the residual r associated with the pde as r = r(u(E), E).
After the last Newton-iteration, the residual is nearly 0 and the chain rule gives
0 = dr/dU * dU/dE + dr/dE
0 = K*dU/dE + dr/dE
dU/dE = -K^-1 * dr/dE (--> evaluate after the last iteration)

In my case, dr/dE is quite simple and I do not need AD to compute it.
My motivation to use AD is to check if the approach
dU/dE = -K^-1 * dr/dE
is correct at all.

But as you said, it is easier to circumvent the differentiation of the matrix iterative process.
(The SolverCG class, for instance, is not templatized anyway to work with AD).


Best
Simon


You received this message because you are subscribed to a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/ur_89avE81k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/B6CA18BA-CC94-4E56-97CD-9DC3ECAA0D68%40gmx.net.
Reply all
Reply to author
Forward
0 new messages