Hi, I am trying to compute the sensitivity of the nodal force and nodal displacement. My idea is to construct form variable representing the nodal force like ufl.inner(P * n, n1)*ds(1)
given in the post Weak form of the resultant force on a surface in FEniCS-X - #4 by garth. Then we can use ufl.derivative(ufl.inner(P * n, n1)*ds(1), u)
to compute the sensitivity with respect to the displacement u
.
However, the result is not accurate compared to the finite difference results. And I guess it is because the proposed form variable ufl.inner(P * n, n1)*ds(1)
is not conservative and defined over a boundary. I think usually ufl.derivative
is robust to compute derivative the well-posed term (like the strain energy) defined over the whole domain. So do we have some ways to compute the sensitivity of the nodal force and nodal displacement?